package com.bootdo.app.controller;

import com.bootdo.app.utils.redis.AppRedisUtil;
import com.bootdo.app.utils.returnresponse.ServerResponse;
import com.bootdo.appsystem.domain.SellercategoryDO;
import com.bootdo.appsystem.service.SellercategoryService;
import com.bootdo.common.redis.shiro.RedisCache;
import com.bootdo.common.redis.shiro.RedisCacheManager;
import com.bootdo.common.redis.shiro.RedisManager;
import com.bootdo.common.redis.shiro.RedisSessionDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;

/**
 * 【@author 】 @fan
 * 【@Email  】 mooncluyed@outlook.com
 * 【类解释  】
 * 【@Date   】 2018/5/12 0012
 **/
@Controller
@RequestMapping("/app/sellercategory/")
public class AppSellerCategoryController {

    @Autowired
    private SellercategoryService sellercategoryService;






    @PostMapping("msgSellclist")
    @ResponseBody
    public ServerResponse<List<SellercategoryDO>> msgSellcList(){
        HashMap<String , Object> map = new HashMap<String , Object>();
        map.put("topid",0);
//        将数据存放redis中!
        List<SellercategoryDO> sellercategoryDOList = null;
        sellercategoryDOList = AppRedisUtil.<String , List<SellercategoryDO>>get("sellerCategoryList");
        if(sellercategoryDOList == null){
            sellercategoryDOList = sellercategoryService.list(map);
            AppRedisUtil.<String , List<SellercategoryDO>>put("msgSellclist",sellercategoryDOList);
        }
        return ServerResponse.createBySuccess(sellercategoryDOList);
    }






}
